/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 小梅就是酱子
 * Date: 2022-02-04
 * Time: 15:42
 */
public class 数组转字符串 {
    public static void main(String[] args) {
        int[] array={1,2,3,4,5};
        System.out.println(myToString(array));

    }
    public static String myToString(int[] array){
        if(array==null) {
            return null;
        }
        String str="[";
        for(int i=0;i< array.length;i++){
            str=str+array[i];
            if(i!= array.length-1){
                str=str+",";
            }
        }
        str=str+"]";
        return str;
    }
}
